package com.itmake.sample.websocket;

import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

/**
 * websocket 配置
 *
 * @author Amjacks
 * @since 2023/08/10
 */
@Configuration
@ConditionalOnWebApplication
public class WebSocketConfig {

    /**
     * 使用boot内置tomcat时需要注入此bean
     */
    @Bean
    public ServerEndpointExporter serverEndpointExporter() {
        return new ServerEndpointExporter();
    }


    @Bean
    public SpringConfigurator springConfigurator() {
        return new SpringConfigurator();
    }
}
